package j2EE.bean.impl;

import j2EE.bean.MailingBean;
import org.springframework.util.StringUtils;

/**
 * Created with Intel IDEA.
 *
 * @Auther: gjt
 * @Date: 2024/9/1 9:38
 */
public class MailingBeanImpl implements MailingBean {
    private String first;
    private String last;
    private String email;
    private String userName;
    private String password;
    private String language;

    @Override
    public String getFirst() {
        return first;
    }

    @Override
    public void setFirst(String first) {
        this.first = first;
    }

    @Override
    public String getLast() {
        return last;
    }

    @Override
    public void setLast(String last) {
        this.last = last;
    }

    @Override
    public String getEmail() {
        return email;
    }

    @Override
    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public boolean doSubscribe() {
        String email1 = this.getEmail();
        if(email1 == null || email1.length() == 0){
            email1 ="23152875653@qq.com";
        }else {
            System.out.println("email:"+email1);
        }
        return !StringUtils.isEmpty(email1);
    }

    @Override
    public String getErrorString() {
        return StringUtils.isEmpty(this.last ) || StringUtils.isEmpty(this.first)?"请输入姓名":"";
    }

    @Override
    public String getUserName() {
        return userName;
    }

    @Override
    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String getLanguage() {
        return language;
    }

    @Override
    public void setLanguage(String language) {
        this.language = language;
    }

    @Override
    public boolean doLogin() {
        return StringUtils.isEmpty(userName) && StringUtils.isEmpty(password);
    }

    @Override
    public boolean isLogin() {
        return StringUtils.isEmpty(language);
    }
}
